<?
//inculde即可以使用data数据。本页所有的data数据，倾在controller都处理好
include_once("../../../common/modules/checkA.php");
include_once("../../../../config.php");
include_once("../../member/controller/detail-list.php");
include_once("../controller/coupon-send.php");
?>





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php include ROOT_PATH_.'/controller/common/modules/head.php'; ?>
    <link href="../asset/css/style.css"   rel="stylesheet" type="text/css"/>

</head>



<body>

<div id="topbar">     <?php include ROOT_PATH_.'/controller/common/modules/topbar.php'; ?> </div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controller/common/modules/sidebar.php'; ?>
        </div>




<div id="content">


    <?php $page_title='优惠券派发';?>
    <?php include ROOT_PATH_.'/controller/common/modules/mod-page-title.php'; ?>



    <div class="flash_box">为避免微信的风控机制，触发滥用信息模板功能，批量发券超过50人，程序自动判断控制优惠券[分批发送]；50人以下，直接即时发送。</div>






    <?php include 'modules/mod-search.php'; ?>





<!-- 用$system_part .list_boxes来控制来到确认板块信息显示-->
<div class="list-box layui-form">


    <form id="send-coupon-form" method="post" action="coupon-send-function.php" enctype="multipart/form-data" class="layui-form">
<!--
        <div class="select-box clearfix layui-form">

        <b>当前派发的优惠券: </b><?echo $coupon_now['name']?> ( <?echo $coupon_now['remark']?>) </label>
       <input type="hidden" value="<?echo $coupon_now['nid']?>" name="coupon_nid" />

            <div class="layui-input-block">
                <input class="layui-input" max="10" min="1" value="1" type="number"name="coupon_num" id="coupon_num1"/>

            </div>
        <button class="layui-btn" lay-submit lay-filter="formDemo">批量发券</button>
        </div>
-->
        <input type="hidden" value="<?echo $coupon_now['nid']?>" name="coupon_nid" />
            <div class="layui-form-item">
                <div class="layui-inline select-box">
                    <b>当前派发的优惠券: </b><?echo $coupon_now['name']?> ( <?echo $coupon_now['remark']?>) </label>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">发券数量</label>
                    <div class="layui-input-inline">
                        <input class="layui-input" max="10" min="1" value="1" type="number"name="coupon_num" id="coupon_num1"/>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label" >
                        <span id="checkmod" onmouseover="show_remark ('【勾选】：选中哪些用户，就发送给哪些用户;【整站】：不理会勾选，直接所有用户都派发。','checkmod')" >
                            <i class="layui-icon">&#xe702;</i> 派券模式
                        </span>
                    </label>
                    <div class="layui-input-inline">
                            <input class="layui-input"  value="勾选"
                                   type="radio" title="勾选"  name="choose_mode" checked
                                   />
                            <input class="layui-input"  value="整站"
                                   type="radio" title="整站"  name="choose_mode"
                                   />
                    </div>
                </div>


                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <button class="layui-btn" lay-submit >批量发券</button>
                    </div>
                </div>
            </div>


<div class="list-boxes ">

<div>

    <span class="layui-btn layui-btn-sm" id="quanxuan"  ><i class="layui-icon">&#x1005;</i>全选</span>
    <span class="layui-btn layui-btn-sm" id="buxuan"><i class="layui-icon">&#xe63f;</i>不选</span>
    <span class="layui-btn layui-btn-sm" style="float: right"  > 人数：<? echo $sum;?> </span>
</div>



    <table class="layui-table">
  <colgroup>
    <col width="50">
    <col width="100">
	<col width="150">
	<col width="150">

      <col width="200">
      <col width="80">
      <col width="150">
      <col width="150">


  </colgroup>
  <thead>
    <tr>
      <th> </th>
      <th>头像</th>
      <th>姓名</th>
        <th>电话</th>
      <th>标签</th>
        <th>是否局长</th>
      <th>注册时间</th>
      <th>平台</th>
<!--      <th>操作</th>-->
    </tr>
  </thead>
  <tbody>



<?php
for ($i = 0; $i < $detailnum; $i++) {
?>


<tr id="item<?echo $detail[$i]['nid']?>" <?if($applymodify['nid']){echo "style='color:red'";$status="审核中";}else{$status="正常";}?>>

<td><input type="checkbox" name="member[]" value="<?echo $detail[$i]['nid']?>"/> </td>


<td><div class="icon"><img src=" <?echo $detail[$i]['headimgurl']?>" width="50"/></div></td>
<td style="color:<?if($detail[$i]['sex']=="1"){echo "#1e9fff";}elseif($detail[$i]['sex']=="2"){echo "#ff1e7b";}?>">
    <?echo $detail[$i]['nickname']?>
    <span >
        <?if($detail[$i]['sex']=="1"){?>
        <i class="fa fa-male" aria-hidden="true">  </i>
        <?}elseif($detail[$i]['sex']=="2"){?>
        <i class="fa fa-female" aria-hidden="true"></i>
        <?}?>
    </span>
</td>


<td><?echo $detail[$i]['phone']?></td>
<td><?echo $detail[$i]['tag']?></td>
<td><?echo $detail[$i]['leader']?></td>
<td><?echo $detail[$i]['createtime']?></td>
<td>
    <span class="layui-badge"> 小程序</span>
    <?if($member_union_2_opennid[$detail[$i]['unionid']]){?>
        <span class="layui-badge layui-bg-green"> 公众号</span>
    <?}?>
</td>


    <?// 恢复单个派发优惠券的功能需要收200元?>
    <?// 恢复单个派发优惠券的功能需要收200元?>
    <?// 恢复单个派发优惠券的功能需要收200元?>
    <?// 恢复单个派发优惠券的功能需要收200元?>
<!--<td>-->
<!--    <a href="coupon-send-alone-function.php?coupon_nid=--><?//echo $coupon_now['nid']?><!--&member=--><?//echo $detail[$i]['nid']?><!----><?//echo $pagenumber_url.$sortby_url.$sys_part.$term_nid ?><!--"-->
<!--       class="layui-btn   layui-btn-sm" >-->
<!--        <i class="fa fa-file-text-o" aria-hidden="true"></i>-->
<!--        派发优惠券-->
<!--    </a>-->
<!--</td>-->


    </tr>
<?}?>


  </tbody>
</table>






</div>

    </form>







<div class="list-box-function"
<? if ($detailnum == 0) {
    echo "style" . "='display:none'";
} ?>
>

    <?php include 'modules/page_numbers_coupon_send.php'; ?>

</div>




<!--list-box end-->
</div>

<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>






<?php include ROOT_PATH_.'/controller/common/modules/footer.php'; ?>
<script>
    //一般直接写在一个js文件中
    layui.use(['layer', 'form'], function(){
        var layer = layui.layer
            ,form = layui.form;


        //全选
        $("#quanxuan").click(function(){
            $("input[name='member[]']").prop("checked",true);
            form.render('checkbox');
            console.log("xxxxxx");
        })

        //不选
        $("#buxuan").click(function(){
            $("input[name='member[]']").prop("checked",false);
            form.render("checkbox");
        })



    });
</script>
</body>
</html>
